﻿@using System.Data;
@using DTcms.Common;
@{
   Layout = "~/Areas/admin/Views/Shared/_LayoutList.cshtml";
   ViewBag.Title = "会员组管理";
   DataTable list = ViewData["list"] as DataTable;
}
@section HeaderContent{
   <script>
      //查询数据
      function search() {
         var text = $("#txtKeywords").val();
         document.location = "index?keywords=" + text;
      }
      //删除数据
      function __doPostBack() {
         var text = $("#txtKeywords").val();
         var $row = $("#ltable tr:gt(0)");
         var json = { list: [] };
         $($row).each(function (i, item) {
            if ($(item).find("input:checkbox").prop("checked")) {
               var id = $(item).find("td:eq(0)").find("label:gt(0)").text();
               var obj = { id: id };
               json.list.push(obj);
            }
         });
         $.ajax({
            url: "SubmitDelete?keywords=" + text,
            type: "POST",
            dataType: "html",
            data: "json=" + JSON.stringify(json),
            success: function (data) {
               eval(data);
            },
            error: function () {
               alert("error");
            }
         });
      }
   </script>
}
<form id="form1"  method="post" action="#">
<!--导航栏-->
<div class="location">
  <a href="javascript:history.back(-1);" class="back"><i class="iconfont icon-up"></i><span>返回上一页</span></a>
  <a href="../../center/index"><i class="iconfont icon-home"></i><span>首页</span></a>
  <i class="arrow iconfont icon-arrow-right"></i>
  <span>会员组别</span>
</div>
<!--/导航栏-->

<!--工具栏-->
<div id="floatHead" class="toolbar-wrap">
  <div class="toolbar">
    <div class="box-wrap">
      <a class="menu-btn"><i class="iconfont icon-more"></i></a>
      <div class="l-list">
        <ul class="icon-list">
          <li><a href="../group_edit/index?action=@DTEnums.ActionEnum.Add"><i class="iconfont icon-close"></i><span>新增</span></a></li>
          <li><a href="javascript:;" onclick="checkAll(this);"><i class="iconfont icon-check"></i><span>全选</span></a></li>
          <li><a href="javascript:;" onclick="ExePostBack('btnDelete');"><i class="iconfont icon-delete"></i><span>删除</span></a></li>
        </ul>
      </div>
      <div class="r-list">
        <input type="text" class="keyword" value="@ViewBag.Keywords" />
        <a href="javascript:search();" id="lbtnSearch" class="btn-search"><i class="iconfont icon-search"></i></a>
      </div>
    </div>
  </div>
</div>
<!--/工具栏-->

<!--列表-->
<div class="table-container">
   <table width="100%" border="0" cellspacing="0" cellpadding="0" id="ltable" class="ltable">
   <tr>
      <th width="8%">选择</th>
      <th align="left">组别名称</th>
      <th width="8%">等级值</th>
      <th width="12%">升级积分</th>
      <th width="12%">初始金额</th>
      <th width="12%">初始积分</th>
      <th width="9%">购物折扣</th>
      <th width="8%">注册组</th>
      <th width="6%">状态</th>
      <th width="10%">操作</th>
   </tr>
   @foreach(DataRow dr in list.Rows){
   <tr>
      <td align="center">
      <span class="checkall" style="vertical-align:middle;">
         <input type="checkbox"/>
      </span>
      <label name="hidId" style="display:none">@dr["id"]</label>
      </td>
      <td>
         <a href="../group_edit/index?action=@DTEnums.ActionEnum.Edit&id=@dr["id"]">@dr["title"]</a>
      </td>
      <td align="center">@dr["grade"]</td>
      <td align="center">@dr["upgrade_exp"]</td>
      <td align="center">@dr["amount"]</td>
      <td align="center">@dr["point"]</td>
      <td align="center">@dr["discount"]%</td>
      <td align="center">@(Convert.ToInt32(dr["is_default"]) == 1 ? "√" : "×")</td>
      <td align="center">@(Convert.ToInt32(dr["is_lock"]) == 1 ? "禁用" : "启用")</td>
      <td align="center">
         <a href="../group_edit/index?action=@DTEnums.ActionEnum.Edit&id=@dr["id"]">修改</a>
      </td>
   </tr>
   }
   @if(list.Rows.Count == 0){
      <tr><td align="center" colspan="10">暂无记录</td></tr>
   }
   </table>
</div>
<!--/列表-->

</form>